package com.zatech.cgnci.project.controller;


import com.zatech.cgnci.project.service.CgnciReinsurerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 分入方案/再保人/交易对手 前端控制器
 * </p>
 *
 * @author Generator
 * @since 2024-12-18
 */
@RestController
@RequestMapping("/api/reinsurer")
@Api(produces = "application/json", tags = "分入方案-再保人-交易对手api接口文档")
@RequiredArgsConstructor
public class CgnciReinsurerController {

    private final CgnciReinsurerService cgnciReinsurerService;

    @GetMapping("/deleteById")
    @ApiOperation(value ="删除")
    public void deleteById(@RequestParam(value = "reinsurerId") Long reinsurerId) {
        cgnciReinsurerService.removeById(reinsurerId);
    }

    @GetMapping("/deleteByIds")
    @ApiOperation(value ="批量删除")
    public void deleteByIds(@RequestParam(value = "reinsurerIds") String reinsurerIds) {
        List<Long> idList = Arrays.stream(reinsurerIds.split(",")).map(Long::valueOf).collect(Collectors.toList());
        cgnciReinsurerService.removeByIds(idList);
    }

}

